﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Yoozoo.UI.YGUI;

namespace com.yoozoo.gta.Extension
{
    public static class GameObjectEx
    {
        public static void PlayAnimator(this GameObject obj, string animationName)
        {
//        obj.transform.PlayAnimator(animationName);
        }
    
    

        public static T AddChild<T>(this GameObject parent, bool isWorldStays = false) where T : Component
        {
            var child = new GameObject();
            child.transform.SetParent(parent.transform, isWorldStays);

            return child.AddComponent<T>();
        }
        
    
        public static YImage AddImage(this GameObject go, Sprite sprite)
        {
            var image    = go.AddComponent<YImage>();
            image.sprite = sprite;

            return image;
        }
    }
}

